import { getToken } from '@/utils/auth'
import defaultSettings, { baseUrl } from '@/settings'

const $_ = [
  {
    label: '',
    prop: 'img',
    headers: {
      Authorization: getToken()
    },
    type: 'upload',
    listType: 'picture-img',
    // listType:'picture-card',
    propsHttp: {
      url: 'data'
    },
    formatter: (row, v) => {
      return v.split(',').map(item => baseUrl + '/' + item)
    },
    action: defaultSettings.uploadImg,
    rules: [
      {
        required: true,
        message: '请上传',
        trigger: 'blur'
      }
    ]
  },

  {
    label: '所属项目',
    prop: 'chargeId',
    type: 'select',
    dicHeaders: {
      Authorization: getToken()
    },
    dicUrl: `${defaultSettings.baseUrl}/charge/list`,
    props: {
      label: 'name',
      value: 'id',
      res: 'data'
    },
    rules: [
      {
        required: true,
        message: '请选择',
        trigger: 'blur'
      }
    ]
  }
]

// :preview-src-list="getImgList(index)"
